<style type="text/css">
.jyui_cell_col .coltime .timetitle {
    font-size: 0.65rem;
}
</style>
<div class="fui-page order-create-page fui-page-current" ng-if="pagedata.op == 'buyland'">
	 <div class="fui-header">
		<div class="fui-header-left" ng-click="goback()">
            <a class="back"></a>
        </div>
		<div class="title">租赁土地</div>
		<div class="fui-header-right"></div>
	</div>
	<div class="fui-content">
	<div class="jy-content" style="padding:0.5rem">
		<div class="weui_cells" style="margin-top:0">
		<div class="weui_cell">
                <div class="weui_cell_hd weui_cell_primary" style="padding:0.3rem 0">
                    <span>地块名称</span>
                </div>
                <div class="weui_cell_ft" ng-model="pagedata.post.ltitle">{{pagedata.lclassify.title}}</div>
        </div>
		<div class="weui_cell">
                <div class="weui_cell_hd weui_cell_primary" style="padding:0.3rem 0">
                    <span>土地名称</span>
                </div>
                <div class="weui_cell_ft" ng-model="pagedata.post.land_title">{{pagedata.land.title}}</div>
        </div>
		<div class="weui_cell">
                <div class="weui_cell_hd weui_cell_primary" style="padding:0.3rem 0">
                    <span>购买面积</span>
                </div>
                <div class="weui_cell_ft" ng-model="pagedata.post.area">{{pagedata.land.area}}㎡</div>
        </div>
		<div class="weui_cell">
                <div class="weui_cell_hd" style="padding:0.3rem 0"><label class="weui_label">联系人</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input ng-model="pagedata.post.username" class="weui_input" type="text" placeholder="请输入联系人">
                </div>
        </div>
		<div class="weui_cell">
                <div class="weui_cell_hd" style="padding:0.3rem 0"><label class="weui_label">联系电话</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input ng-model="pagedata.post.mobile" class="weui_input" type="text" placeholder="请输入电话">
                </div>
        </div>
		<div class="weui_cells_title">租赁时长</div>
		 <div class="fui-tab-scroll" style="height: 3.2rem">
			<div class="xcontainer weui_cells_radio3" style="z-index:0;height: 3.2rem;padding:0.3rem">
			    <label class="jyui_cell_col" ng-repeat="item in pagedata.month">
					<div ng-class="{'coltime':1,'colchecked':pagedata.post.month==item}" ng-click="getdata(pagedata.land.id,item,pagedata.land.area);pagedata.post.month=item;">
						<div class="timetitle"><span>{{item}}月</span></div>
						<div class="timetitle"><span style="font-size:0.55rem">￥{{pagedata.land.area*pagedata.land.price * item}}</span></div>
					</div>
				</label>
			</div>
		</div>
		<div class="weui_cell">
                <div class="weui_cell_hd weui_cell_primary" style="padding:0.3rem 0">
                    <span>费用</span>
                </div>
                <div class="weui_cell_ft" ng-model="pagedata.post.money">￥{{pagedata.post.money}}元</div>
        </div>
		 </div>
		<div class="weui_btn_area">																			
			 <a ng-if="!pagedata.order_id" class="weui_btn weui_btn_primary" href="javascript:" id="showTooltips" ng-click="pagedata.pay()">确认支付</a>
			 <a ng-if="pagedata.order_id" class="weui_btn weui_btn_primary" href="javascript:" id="showTooltips" ng-click="access_json('jy_farmer/order//type=land_list')">查看订单</a>
		</div>
		 </div>
</div>
</div>
<div ng-include="sys_html('_footer')"></div>
<script>
window.scope.location(function(re){
	var pcd = scope.pagedata.post.pcd
	if(!pcd || pcd =='' || !pcd.province){
		scope.pagedata.post.pcd.province = re.addressComponents.province
		scope.pagedata.post.pcd.city = re.addressComponents.city
		scope.pagedata.post.pcd.district = re.addressComponents.district
		scope.$evalAsync();
	}
});
</script>
<script type="text/javascript">
	scope.getdata = function(id,month,area){
		var params1 = {
					'plugin':'jy_farmer',
					'action':'buyland',
					'op':'money',
					'query':'id='+id+'&time='+month+'&area='+area,
					'data':{},
					'callback':function(data){
							if(data.success == 1){
								scope.$apply(function(){
									scope.pagedata.post.money = data.money;
								});
							}
					}
		}
		scope.post_json(params1);
}
scope.pagedata.pay=function(){
	scope.post_json('jy_farmer/buyland/notice/',scope.pagedata.post,function(result){
		scope.pagedata.order_id=result.order_id;
		scope.$evalAsync();
		scope.tool.pay(result.pay_id,function(res){
				if(res.type=='success'){
					scope.message('支付成功！','success','jy_farmer/myplant/');
				}else{
					scope.message('支付失败！','success','jy_farmer/order//type=land_list');
				}
		},'','','jy_farmer/order//type=land_list');
	});
}
</script>